var ControlFactory = function() {

	return {

		controls : {},

		bdControls : function(key) {
			var control;
			if (key == 'vpc') {
				control = new ViewPortCtl();
			} else if (key == 's') {
				control = new Server();
			} else if (key == 'gcc') {
				control = new GlobalConfigCtl();
			} else if (key == 'otc') {
				control = new OptTreeCtl();
			} else if (key == 'rpc') {
				control = new ResultPanelCtl();
			} else if (key == 'sfc') {
				control = new SearchFormCtl();

				//--------------------------order---------------------------------
			} else if (key == 'ofc') {
				control = new OrderFormCtl();
			} else if (key == 'owc') {
				control = new OrderWinCtl();
			} else if (key == 'oigc') {
				control = new OrderItemGridCtl();
			} else if (key == 'oagc') {
				control = new OrderAuditGridCtl();
			} else if (key == 'oscgc') {
				control = new OrderShowContentGridCtl();
			} else if (key == 'osfc') {
				control = new OrderShowFormCtl();
			} else if (key == 'oswc') {
				control = new OrderShowWinCtl();
			} else if (key == 'ocgc') {
				control = new OrderContractGridCtl();
			} else if (key == 'opc') {
				control = new OrderPanelCtl();
			} else if (key == 'ogc') {
				control = new OrderGridCtl();

				//--------------------------------agree-------------------------------
			} else if (key == 'aigc') {
				control = new AgreeInfoGridCtl();
			} else if (key == 'aapwc') {
				control = new AgreeAddPlusWinCtl();
			} else if (key == 'aapfc') {
				control = new AgreeAddPlusFormCtl();
			} else if (key == 'aapcc') {
				control = new AgreeContentGridCtl();
			} else if (key == 'aawc') {
				control = new AgreeAddWinCtl();
			} else if (key == 'acgc') {
				control = new AgreeContentGridCtl();
			} else if (key == 'acwc') {
				control = new AgreeContentWinCtl();
			} else if (key == 'acfc') {
				control = new AgreeContentFormCtl();
			} else if (key == 'aagc') {
				control = new AgreeAuditGridCtl();
			} else if (key == 'asfc') {
				control = new AgreeShowFormCtl();
			} else if (key == 'aswc') {
				control = new AgreeShowWinCtl();
			} else if (key == 'ascgc') {
				control = new AgreeShowContentGridCtl();
			} else if (key == 'aafc') {
				control = new AgreeAddFormCtl();

				//-----------------------------------------------------------------
			} else if (key == 'tcc') {
				control = new TicketCardCtl();
			} else if (key == 'tfc') {
				control = new TicketFormCtl();
			} else if (key == 'egc') {
				control = new ExecutedGridCtl();
			} else if (key == 'ugc') {
				control = new UnexecutedGridCtl();

				//-----------------------customer---------------------------
			} else if (key == 'cfc') {
				control = new CustomerFormCtl();
			} else if (key == 'cgc') {
				control = new CustomerGridCtl();
			} else if (key == 'cigc') {
				control = new CustomerInfoGridCtl();
			} else if (key == 'cafc') {
				control = new CustomerAddFormCtl();
			} else if (key == 'csfc') {
				control = new CustomerShowFormCtl();
			} else if (key == 'cswc') {
				control = new CustomerShowWinCtl();
			} else if (key == 'ccpc') {
				control = new CustomerConflictPanelCtl();
			} else if (key == 'ccfc') {
				control = new CustomerConflictFormCtl();
			} else if (key == 'ccgc') {
				control = new CustomerConflictGridCtl();
			} else if (key == 'cagc') {
				control = new CustomerAuditGridCtl();
			} else if (key == 'cngc') {
				control = new ConNectorGridCtl();
			} else if (key == 'cnfc') {
				control = new ConNectorFormCtl();
			} else if (key == 'cnfwc') {
				control = new ConNectorFormWinCtl();
			} else if (key == 'cpc') {
				control = new CustomerPanelCtl();
			} else if (key == 'cawc') {
				control = new CustomerAddWinCtl();

				//--------------------------user----------------------------
			} else if (key == 'uafc') {
				control = new UserAddFormCtl();
			} else if (key == 'usrmger') {
				control = new UserInfoGridCtl();
			} else if (key == 'rgc') {
				control = new RoleGridCtl();
			} else if (key == 'uofc') {
				control = new UserOwnFormCtl();
			} else if (key == 'uawc') {
				control = new UserAddWinCtl();
				//--------------------------work----------------------------
			} else if (key == 'wagc') {
				control = new WorkAuditGridCtl();
			} else if (key == 'wgc') {
				control = new WorkGridCtl();
			} else if (key == 'wdwc') {
				control = new WorkDistributeWinCtl();
			} else if (key == 'wdfc') {
				control = new WorkDistributeFormCtl();

				//-------------------------finish---------------------------
			} else if (key == 'fgc') {
				control = new FinishGridCtl();
				
				//-------------------------bill-----------------------------
			}else if (key == 'billGrid') {
				control = new BillGrid();
			}else if (key == 'billManagerPanel') {
				control = new BillManagerPanel();
			}

			
			
			return control;
		},

		getInstance : function() {
			return this;
		},
		putControls : function(key, o) {
			this.controls[key] = o;
		},
		getControls : function(key) {
			return this.controls[key];
		},
		getC : function(key) {
			var control = this.getControls(key);
			if (!control) {
				control = this.bdControls(key);
				this.putControls(key, control);
			}
			return control;
		}
	}
}();

var cf = ControlFactory;